<?php
include_once("../../DataProvider.php");
if(isset($_POST["idGame"]) && isset($_POST["gamename"]) &&isset($_POST["price"]) &&isset($_POST["size"]) &&isset($_POST["menu"]) &&isset($_POST["dev"])    )
{
	$size = (int)$_POST["size"];
	$id = $_POST["idGame"];
	$name = $_POST["gamename"];
	$price = (float)$_POST["price"];
	$dev = (int)$_POST["dev"];
	$cate = (int)$_POST["menu"];
	if(isset($_POST["Hot"]))
		$status = (int)$_POST["Hot"];
	else
		$status = 0;
	$modified = date("Y-m-d");
	$sql = "update tbl_games set lastModified = '$modified', gameName = '$name', Size = $size, Price = $price, CategoriesID = $cate, Device = $dev, Status = $status where gameID = $id";
	$result = DataProvider::ExecuteQuery($sql);
	if($result)
	{
		header("Location: ../home.php");
	}
	else
	{
		echo "error";
	}
}
?>